package com.timeDeal.servlet;


import com.alibaba.druid.util.StringUtils;
import com.timeDeal.service.AdminService;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


/**
 * Created by Administrator on 2016/7/24.
 */

public class CheXiaoServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, IOException, IOException {
            String id = request.getParameter("id");
            String flag = org.apache.commons.lang3.StringUtils.defaultString(request.getParameter("flag"),"0");
            AdminService adminservice = new AdminService();
           if(StringUtils.equals(flag,"0")) {
               if (adminservice.Delete(Integer.valueOf(id), "xuqiufabu")) {
                   request.getRequestDispatcher("/user/wofabudegg.jsp").forward(request, response);
               }
           }else {
               if (adminservice.Delete(Integer.valueOf(id), "shijianchushou")) {
                   request.getRequestDispatcher("/user/wofabudegg.jsp?flag=1").forward(request, response);
               }
           }
    }
}